package com.lytoyo.neihanduanzi.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class ThreadPoolExecutorConfig {
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        //创建线程池
        return new ThreadPoolExecutor(
                10,     //核心线程数
                28,             //最大线程数
                3,             //空闲线程存活时间
                TimeUnit.SECONDS,   //时间单位
                new ArrayBlockingQueue<>(1000)  //阻塞队列
        );
    }

}